package com.juntuo.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.juntuo.entity.Device;
import com.juntuo.entity.DeviceHistory;
import com.juntuo.mapper.DeviceHistoryMapper;
import com.juntuo.mapper.DeviceMapper;
import com.juntuo.service.DeviceHistoryService;
import com.juntuo.service.DeviceService;
import com.juntuo.service.ParkService;
import com.juntuo.service.helper.CommonServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 简介：片区 街道 泊位的服务
 * 作者：Jason (chenxj@hadlinks.com)
 * 时间：2018/3/17 16:22
 */
@Service
public class DeviceHistoryServiceImpl extends CommonServiceImpl<DeviceHistory> implements DeviceHistoryService {
    @Autowired
    private DeviceHistoryMapper deviceHistoryMapper;


    @Override
    public PageInfo<Map<String,Object>> findPagedDeviceHistory(int pageNum,int pageSize,String name) {

        PageHelper.startPage(pageNum,pageSize);
        List<Map<String,Object>> devices=deviceHistoryMapper.selectByParams(name);
        PageInfo pageInfo= new PageInfo(devices);
        return pageInfo;

    }

    @Override
    public List<DeviceHistory> selectGroupedLastRecord() {
        return deviceHistoryMapper.selectGroupedLastRecord();
    }
}
